<template>
<a-modal
:open="open"
:centered=true
:title=ownTitle
ok-text="确定"
cancel-text="取消"
@ok="handleOk"
@cancel="handleCancel"
>
  <a-form :model="form">
    <a-col span="24">
      <a-form-item
      label="疾病名称"
      :labelCol="{ span: 4 }"
      :wrapperCol="{ span: 20 }"
      :rules="[
        { required: true, message: '请输入疾病名称' },
      ]"
      >
        <a-input v-model:value="form.feature" placeholder="请输入要添加的疾病名称" />
      </a-form-item>
    </a-col>
  </a-form>
</a-modal>
</template>

<script setup>
import {computed, reactive, ref} from "vue";
const open= ref(false)
const props = defineProps(['title'])
const ownTitle = computed(() => {
  return `添加【${props.title}】分类`
})
const form = reactive({
  feature:''
})
const emit = defineEmits(['close','ok'])
const handleCancel = () => {
  open.value = false
  //清空输入
  form.feature = ''
}
const handleOk = ()=>{
  emit('ok', {name:name[props.title].trim(),feature:form.feature.trim()})
  handleCancel()
}
const name = {
  "正常": "normal",
  "鼻炎": "noseFeatures",
  "其他": "other"
}

defineExpose({open})
</script>

<style scoped>

</style>
